#ifndef __THREADPOOL_H__ 
#define __THREADPOOL_H__
#include "Thread.hpp"
#include "TaskQueue.hpp"
#include <vector>
#include <memory>
#include <functional>
using std::vector;
using std::unique_ptr;

using ElemType = std::function<void()>;
namespace wd{

class ThreadPool{
friend class Consumer;
public:

    ThreadPool(int,int);
    void start();
    void stop();
    void addTask(ElemType &&);
    
private:
    void doTask();

private:
    vector<unique_ptr<Thread>> _threads;
    TaskQueue                    _taskque;    
    int                          _threadNum;
    int                          _queSize;
    bool                         _isExit;

};



}
#endif

